<template>
  <view class="submit-card">
    <view class="s-title">{{title || '确认开启相亲'}}</view>
    <view class="s-content">{{ content ||textContent }}</view>
    <view class="s-btns">
      <custom-btn class="s-btn" @click="cancelFn">取消</custom-btn>
      <custom-btn class="s-btn" @click="confirmFn">开启相亲</custom-btn>
    </view>
  </view>
</template>

<script setup>
// 引入api
import useStore from "@/store";
import { editUserDetail } from "@/api/my";
const { common, app } = useStore();
const fatherFn = inject("fatherFn", {});
const textContent = ref(
  "开启相亲后，恢复正常推荐，其他用户可以通过解锁您的联系方式正常联系您，是否开启?"
);

const title = computed(() => common.submitParams?.title);
const content = computed(() => common.submitParams?.content);

const cancelFn = () => {
  common.updatePopupOpen(false, "submit");
};
const confirmFn = () => {
  const user_info = {
    status: 0,
    stop_reason: "",
  };
  editUserDetail({ user_info: JSON.stringify(user_info) }).then((res) => {
    common.updatePopupOpen(false, "submit");
    uni.showToast({
      title: "开启成功",
      icon: "none",
    });

    if (fatherFn.confirmFn) {
      fatherFn.confirmFn();
    } else {
      app.getUserInfo();
    }
  });
};
</script>

<style lang=scss scoped>
.submit-card {
  width: 650rpx;
  @include borderBox;
  padding: 60rpx 40rpx;
  background: #fff;
  border-radius: 30rpx;
  .s-title {
    font-weight: 800;
    font-size: 44rpx;
    color: #000;
    text-align: center;
  }
  .s-content {
    font-weight: 500;
    font-size: 36rpx;
    color: #666;
    padding: 40rpx 0 50rpx;
  }

  .s-btns {
    display: flex;
    justify-content: space-between;
    .s-btn {
      width: 270rpx;
      height: 120rpx;
      font-weight: 500;
      font-size: 40rpx;
      color: #ccc;
      line-height: 120rpx;
      border-radius: 120rpx;
      background: #fff;
      border-radius: 120rpx 120rpx 120rpx 120rpx;
      border: 1rpx solid #dddddd;
      &:last-child {
        color: #fff;
        box-shadow: 0rpx 20rpx 40rpx 0rpx rgba(241, 55, 64, 0.25);
        background: linear-gradient(
          180deg,
          rgba(241, 55, 64, 0.9) 0%,
          #f13740 100%
        );
      }
    }
  }
}
</style>